//
//  NewsCell.m
//  Mtime
//
//  Created by Mac on 15/8/7.
//  Copyright (c) 2015年 wxk. All rights reserved.
//

#import "NewsCell.h"

@implementation NewsCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setModel:(NewsModel *)model {

    _model = model;
    
    if ([model.type isEqual:@1]) {
        
        [self reloadData1];
    }else {
    
        [self reloadData2];
    }
    
    
}

- (void)reloadData1 {
 
    _title_1.text = _model.title;
    
    [_imageV1_1 setImageWithURL:[NSURL URLWithString:[[_model.images objectAtIndex:0] objectForKey:@"url1"]]];
    
    [_imageV2_1 setImageWithURL:[NSURL URLWithString:[[_model.images objectAtIndex:1] objectForKey:@"url1"]]];
    
    [_imageV3_1 setImageWithURL:[NSURL URLWithString:[[_model.images objectAtIndex:2] objectForKey:@"url1"]]];

    _time_1.text = [NSString stringWithFormat:@"%.f小时前",[_model.publishTime floatValue]/360000000];
    
    _count_1.text = [NSString stringWithFormat:@"%@人评论",_model.commentCount];


}

- (void)reloadData2 {

    [_imageV_2 setImageWithURL:[NSURL URLWithString:_model.image]];
    
    _title_1.text = _model.title;
    
    _time_2.text = [NSString stringWithFormat:@"%.f小时前",[_model.publishTime floatValue]/360000000];
    
    _count_2.text = [NSString stringWithFormat:@"%@人评论",_model.commentCount];

    _comment_2.text = _model.summary;

}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
